Porting Duplicate MAC Test to Origin - #31478
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shreyasbe The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe change adds a serial bare-metal EgressIP failover test. It allocates an EgressIP, monitors migration during ChangesBare-metal EgressIP failover validation
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant EgressIPTest
participant OVNKubernetesNode
participant EgressIP
participant NetworkProbe
participant Nftables
EgressIPTest->>EgressIP: assign bare-metal EgressIP
EgressIPTest->>OVNKubernetesNode: delete egress node ovnkube-node pod
OVNKubernetesNode-->>EgressIP: migrate EgressIP
EgressIPTest->>NetworkProbe: probe EgressIP MAC responses
NetworkProbe-->>EgressIPTest: return observed MACs
EgressIPTest->>Nftables: verify table cleanup
EgressIPTest->>OVNKubernetesNode: verify pod recovery
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 2 warnings)
✅ Passed checks (12 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
2516552 to
60733c7
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (2)
test/extended/networking/egressip.go (2)
639-642: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winRestore only the labels that this test added.
The
AfterEachremovesk8s.ovn.org/egress-assignablefrom every worker node. If a node carried that label before this test ran, the test leaves the cluster in a different state and can affect later specs. Track the nodes that the test labels, and remove the label only from those nodes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/extended/networking/egressip.go` around lines 639 - 642, Update the egress-label cleanup in the test’s AfterEach block to track which worker nodes were labeled by this test and remove k8s.ovn.org/egress-assignable only from those nodes. Preserve pre-existing labels on all other nodes, using the existing worker-node setup and labeling flow to maintain the tracked-node set.
738-762: 🩺 Stability & Availability | 🔵 Trivial | 🏗️ Heavy lift
oc debugpolling is too slow to observe a transient nftables chain.The ticker fires every 200 ms, but each iteration starts a new debug pod on the node. Pod creation and scheduling normally take several seconds. The effective probe interval is therefore seconds, not 200 ms. The
egressip-dropchain exists only during the shutdown window ofovnkube-node, so the check can miss it and the test becomes flaky.Consider one long-lived debug session that loops inside the node shell, or a privileged host-network pod that is created before the deletion and polls locally.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/extended/networking/egressip.go` around lines 738 - 762, Replace the per-tick oc.AsAdmin().Run("debug") invocation in the nftChainFound polling goroutine with a long-lived node debug session established before polling, and execute a shell loop inside that session to repeatedly check nftChainCheckCmd locally at the required interval. Ensure the session remains active through ovnkube-node termination, signals nftChainFound when the command detects “FOUND,” and still exits cleanly via stopChecking with proper resource cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/extended/networking/egressip_helpers.go`:
- Around line 1873-1880: Update findNodeEgressIPsBaremetal around the ipnetStr
selection and getFirstFreeIPs call to prevent IPv6 CIDRs from reaching unbounded
address enumeration. Restrict this bare-metal allocation path to IPv4, or
validate the selected CIDR’s prefix length before calling getFirstFreeIPs and
return a clear error for unsupported IPv6 ranges.
- Around line 1839-1846: Handle the error returned by listEgressIPs in the
surrounding helper instead of ignoring it: return or propagate the error
immediately when it is non-nil, and only iterate over egressipList.Items to
populate reservedIPs after a successful call.
- Around line 1790-1824: Add a preflight check before the retry loop that
verifies the selected arping or ndisc6 binary is available in the probe pod,
using the existing adminExecInPod execution context. If the check fails, return
immediately with an error explicitly naming the missing binary; only enter the
MAC-probing loop after presence is confirmed.
In `@test/extended/networking/egressip.go`:
- Around line 771-780: Update the shutdown verification around the nftChainFound
select to close stopChecking exactly once: remove the timeout-branch close and
register a defer immediately after starting the checker goroutine to close the
channel. Preserve the existing timeout failure behavior and successful
verification flow.
- Around line 838-846: Update the nftables cleanup verification around
adminExecInPod so it always validates the command output, including when the
command returns a non-zero error because the table is absent. Retain only the
“No such file” matcher, and fail explicitly for unexpected adminExecInPod errors
instead of logging success unconditionally.
- Around line 694-705: Update the networking test flow around
findBridgePhysicalInterface to resolve and retain separate physical interface
names for egressNode1Name, egressNode2Name, and the probe node. Use each node’s
matching interface for getNodeInterfaceMAC, the discovery command, and
checkForDuplicateMACOnNode instead of reusing egressNode1Name’s interface.
---
Nitpick comments:
In `@test/extended/networking/egressip.go`:
- Around line 639-642: Update the egress-label cleanup in the test’s AfterEach
block to track which worker nodes were labeled by this test and remove
k8s.ovn.org/egress-assignable only from those nodes. Preserve pre-existing
labels on all other nodes, using the existing worker-node setup and labeling
flow to maintain the tracked-node set.
- Around line 738-762: Replace the per-tick oc.AsAdmin().Run("debug") invocation
in the nftChainFound polling goroutine with a long-lived node debug session
established before polling, and execute a shell loop inside that session to
repeatedly check nftChainCheckCmd locally at the required interval. Ensure the
session remains active through ovnkube-node termination, signals nftChainFound
when the command detects “FOUND,” and still exits cleanly via stopChecking with
proper resource cleanup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: e8d13884-9dab-49b5-8305-d877c36cc8dd
📒 Files selected for processing (2)
test/extended/networking/egressip.gotest/extended/networking/egressip_helpers.go
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/extended/networking/egressip.go`:
- Around line 664-667: In the EgressIP validation flow after
findNodeEgressIPsBaremetal returns, assert that nodeEgressIPMap[egressNode1Name]
contains at least one address before indexing element 0. Keep the existing error
assertion and logging behavior, but report a clear test failure when no EgressIP
was allocated instead of allowing an index-out-of-range panic.
- Around line 593-607: Update the platform check in the egress IP test to read
the type from infra.Status.PlatformStatus.Type instead of
infra.Spec.PlatformSpec.Type. Guard against a nil PlatformStatus and preserve
the existing cloud-platform skip behavior when the status type matches an
unsupported platform.
- Around line 733-764: Update the nftables monitoring goroutine around
nftChainCheckCmd to use a separate CLI instance from the main test path,
preventing concurrent mutation of shared oc command state during Output
execution. Also increase the ticker interval beyond 200ms to allow each oc debug
invocation to complete without queuing repeated commands and adding unnecessary
cluster load.
- Around line 711-726: Replace the isIPv6-based branching in the discovery and
duplicate-MAC validation flow with a family check derived from
net.ParseIP(egressIPStr).To4() == nil. Use that result to select the IPv6 ndisc6
command and regex for IPv6 allocated addresses, while preserving the arping path
for IPv4 addresses, including dual-stack clusters.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 56378f26-947d-44f6-bb53-ee831699ca04
📒 Files selected for processing (2)
test/extended/networking/egressip.gotest/extended/networking/egressip_helpers.go
🚧 Files skipped from review as they are similar to previous changes (1)
- test/extended/networking/egressip_helpers.go
|
/testwith openshift/ovn-kubernetes/main/e2e-metal-ipi-serial-ovn-ipv4 openshift/ovn-kubernetes#3357 |
|
@shreyasbe, |
|
/testwith openshift/ovn-kubernetes/main/e2e-metal-ipi-serial-ovn-ipv4 openshift/ovn-kubernetes#3357 |
|
@shreyasbe, |
|
Scheduling required tests: |
|
/testwith openshift/ovn-kubernetes/main/e2e-metal-ipi-ovn-dualstack openshift/ovn-kubernetes#3357 |
|
/testwith openshift/ovn-kubernetes/main/e2e-metal-ipi-ovn-ipv4 openshift/ovn-kubernetes#3357 |
|
/retest e2e-gcp-ovn |
|
/retest e2e-metal-ipi-ovn-ipv6 |
|
/test e2e-gcp-ovn |
|
/test e2e-gcp-ovn |
arghosh93
left a comment
There was a problem hiding this comment.
I have not yet checked in detail. At the moment I have two general comment about the test. I would also request you to address coderabbit comments if those matters. Otherwise you can add your argument and cose those conversations if coderabbit agrees.
| <-goroutineReady | ||
| framework.Logf("Nftables chain monitoring goroutine started") | ||
|
|
||
| g.By("11. Deleting ovnkube-node pod on egress node 1 to trigger nftables rules and EgressIP migration") |
There was a problem hiding this comment.
Is this enough to cause egressip reassignment? otherwise the test will become flaky.
There was a problem hiding this comment.
Yes, Pod Deletion Reliably Triggers EgressIP Reassignment.
| }) // end testing to external targets | ||
| }) | ||
|
|
||
| var _ = g.Describe("[sig-network][Feature:EgressIP][apigroup:operator.openshift.io] EgressIP duplicate MAC prevention", func() { |
There was a problem hiding this comment.
We don't need a separate describe block. Please integrate with the existing one.
|
/testwith openshift/ovn-kubernetes/main/e2e-metal-ipi-serial-ovn-ipv6 openshift/ovn-kubernetes#3357 |
|
@shreyasbe, |
|
/test e2e-metal-ipi-serial-ovn-ipv6 |
…fra.Status.PlatformStatus.Type with a nil PlatformStatus guard Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
|
Scheduling required tests: |
…dexing Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
…er node Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
… allocated EgressIP family Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
… to 2s Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
…flight, error handling, and IPv6 guard Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
Signed-off-by: Shreyas Be <52690686+shreyasbe@users.noreply.github.com>
|
@shreyasbe: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/testwith openshift/ovn-kubernetes/main/e2e-metal-ipi-ovn-ipv4 openshift/ovn-kubernetes#3357 |
Summary by CodeRabbit